﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Calendar.aspx.cs" Inherits="VisualAgile.Web.Views.Project.Calendar" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="../../Content/fonts-min.css" rel="stylesheet" type="text/css"></link>
    <script language="javascript">
        // ------------------------------------------------
        // private functions
        // ------------------------------------------------
        function getCmps() {
            return {
                frmProject: settingsWin.items.get(0).items.get(0).items.get(0),
                frmTeam: settingsWin.items.get(0).items.get(1).items.get(0),
                frmUserName: settingsWin.items.get(0).items.get(0).items.get(0).items.get(0),
                frmop: settingsWin.items.get(0).items.get(0).items.get(0).items.get(1),
                frmnp: settingsWin.items.get(0).items.get(0).items.get(0).items.get(2),
                frmcp: settingsWin.items.get(0).items.get(0).items.get(0).items.get(3),
                frmFirstName: settingsWin.items.get(0).items.get(0).items.get(0).items.get(4),
                frmLastName: settingsWin.items.get(0).items.get(0).items.get(0).items.get(5),
                frmEmail: settingsWin.items.get(0).items.get(0).items.get(0).items.get(6),
                grdUsers: Ext.getCmp('ExtGridPanel1')
            };
        }; // end getCmps
        function basicVal(val) {
            var myRegxp = /^([a-zA-Z0-9_-]+)$/;
            var isVal = true;
            if (myRegxp.test(val) == false) {
                isVal = "Only Letters and Numbers are Allowed.";
            }
            if (val.length < 3) {
                isVal = "Must be More Than 3 Characters.";
            }
            return isVal;
        }; // end basicVal

        function deleteRecord(btn) {
            if (btn == 'yes') {
                var selectedRows = getCmps().grdUsers.selModel.selections.items;
                var selectedKeys = getCmps().grdUsers.selModel.selections.keys;
                Ext.MessageBox.show({
                    msg: 'Data is requested, please wait',
                    progressText: 'Request data is',
                    width: 300,
                    wait: true,
                    waitConfig: {
                        interval: 200
                    }
                });
                Ext.Ajax.request({
                    url: '../User/DeleteUser',
                    method: 'POST',
                    params: {
                        "userid": selectedKeys
                    }, // the unique id(s)
                    callback: function(options, success, response) {
                        if (success) {
                            Ext.MessageBox.hide();
                            var result = Ext.util.JSON.decode(response.responseText)
                            //Ext.MessageBox.alert("Message", result.Message);
                        } else {
                            Ext.MessageBox.hide();
                            Ext.MessageBox.alert("Failure, please try again", response.responseText);
                        }
                    },
                    // the function to be called upon failure of the request
                    // (server script, 404, or 403 errors)
                    failure: function(response, options) {
                        Ext.MessageBox.hide();
                        ReturnValue = Ext.MessageBox.alert("Warning, There was an unexpected error! Please contact administrator！");
                    },
                    success: function(response, options) {
                        Ext.MessageBox.hide();
                        Ext.getCmp('ExtGridPanel1').store.reload();
                    }
                })// end Ajax request
            } // end if click 'yes' on button
        } // end deleteRecord
    </script>
</head>
<body>
    <mvc:ExtScriptManager ID="ExtScriptManager" runat="server" />
    <mvc:ExtJSON ID="windowCfgs" runat="server">
        <xtype>
            <mvc:ExtItem layout="border" width="600" title="Settings" height="500">
                <items>
                    <mvc:ExtItem xtype="panel" layout="table" region="center" 
                        anchor="100% 0" layoutConfig="{columns: 3}" frame="false" border="false">
                        <defaults>
                            <mvc:ConfigItem name="bodyStyle" value="padding:20px" /> 
                        </defaults>                        
                        <items>
                            <mvc:ExtItem>
                                <html>rfdasdsdasdasd</html>
                            </mvc:ExtItem>
                            <mvc:ExtItem>
                                <html>rfdasdsdasdasd</html>
                            </mvc:ExtItem>
                             <mvc:ExtItem>
                                <html>rfdasdsdasdasd</html>
                            </mvc:ExtItem>
                             <mvc:ExtItem>
                                <html>rfdasdsdasdasd</html>
                            </mvc:ExtItem>
                        </items>
                    </mvc:ExtItem>
                </items>                
            </mvc:ExtItem>
        </xtype>

        <script>
            Ext.namespace("dlr.cmp.workSpace");
            dlr.cmp.workSpace.calendarWindow = function(cfg) {
                var that = this;
                var windowCfg = windowCfgs;
                var ldMsk = null;

                // ------------------------------------------------
                // public properties
                // ------------------------------------------------
                // ------------------------------------------------
                // public methods
                // ------------------------------------------------
                // ------------------------------------------------
                // constructor code
                // ------------------------------------------------
                Ext.apply(this, cfg);
                // apply private cfgs
                Ext.apply(this, windowCfg);
                dlr.cmp.workSpace.calendarWindow.superclass.constructor.call(this, cfg);
                // events
            };
            Ext.extend(dlr.cmp.workSpace.calendarWindow, Ext.Window);
            Ext.reg("calendarWindow", dlr.cmp.workSpace.calendarWindow);
        </script>

    </mvc:ExtJSON>
    <mvc:ExtOnReady ID="readyScript" runat="server">

        <script>
            calendarWin = new dlr.cmp.workSpace.calendarWindow();

            calendarWin.show();                      
            
        </script>        
    </mvc:ExtOnReady>  
</body>
</html>

